﻿using System;
using System.Text.RegularExpressions;
// 正则表达书 https://www.w3cschool.cn/csharp/csharp-regular-expressions.html
namespace demo11
{
    class Program
    {
        // 匹配了以 'm' 开头以 'e' 结尾的单词：
        private static void showMatch(string text, string expr)
        {
            Console.WriteLine("The Expression: " + expr);
            MatchCollection mc = Regex.Matches(text, expr);
            foreach (Match m in mc)
            {
                Console.WriteLine (m);
            }
        }

        static void Main(string[] args)
        {
            string str = "make maze and manage to measure it";

            Console
                .WriteLine("Matching words start with 'm' and ends with 'e':");
            showMatch(str, @"\bm\S*e\b");
            Console.ReadKey();
        }
    }
}
